// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using NSQL.Generator;
using NSQL.Resource;
using NSQL.Statements;

namespace NSQL.Extensions
{
    public static class MySqlGeneratorExtensions
    {
        public static string ToMySql(this IStatement statement, Func<SqlGeneratorSettings, SqlGeneratorSettings> setupAction)
        {
            return new MySqlGenerator(setupAction).Generate(statement);
        }
        public static string ToMySql(this IStatement statement, SqlGeneratorSettings settings)
        {
            return new MySqlGenerator(settings).Generate(statement);
        }

        public static string ToMySql(this IStatement statement)
        {
            return MySqlGenerator.Instance.Generate(statement);
        }

        public static string ToMySql(this IStatement statement, IDatabaseInfo databaseInfo)
        {
            return new MySqlGenerator(new SqlGeneratorSettings
            {
                Database = databaseInfo,
                LetterCase = LetterCase.LowerCase
            }).Generate(statement);
        }
    }
}